const App = {
    mixins: [Query],//配置文件，路径/utils/mixins.js
    data() {
        return {
            page: {
                activeName:'first',
                value1: '',
                value2:'',
                SQLSerialNumber:'t_address_book',
                PageNumber: 1, //页码
                RowAmount: 10,
                Condition: window.btoa(unescape(encodeURIComponent('%%,%%')))
            },
            // t_address_book2
        }
    },
    mounted() {

    },
    methods: {
        handleClick(){
            if (this.page.activeName == 'first') {
                this.page.SQLSerialNumber = 't_address_book';
                this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value1 + "%,%" + this.page.value2 + "%")))
                this.postgetList(this.page);
            } else {
                this.page.SQLSerialNumber = 't_address_book2';
                this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value1 + "%,%" + this.page.value2 + "%,%"+this.page.activeName+"%")))
                this.postgetList(this.page);
            }
        },
        postgetList(page) {
            const { TableName } = JSON.parse(document.getElementById("table").getAttribute("data-options"));
            const that = this;
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalPaginationQueryBySQLSerialNumber`,
                method: "post",
                data: {
                    Condition: page.Condition,
                    PaginationNumber: page.PageNumber,
                    ...page
                },
                success: (res) => {
                    that.Total = res.TotalRows;//总数量
                    that.loading = false;
                    that.Tabletdata = res.Rows;
                    let lJSONObject_DataSet = {
                        Add: {
                            base_operation_log: [{
                                Operation_Type: '0',
                                Operation_Path: this.relativePath,
                                Operation_Main: JSON.stringify(deepClone({
                                    Data: res.Rows,
                                    Param: {
                                        Model_Url: this.relativePath,
                                        Condition: page.Condition,
                                        PaginationNumber: page.PageNumber,
                                        ...page
                                    }
                                })),
                                Operation_Interface: "generalPaginationQueryBySQLSerialNumber",
                                Operation_IP: getIpAddress()
                            }]
                        }
                    }
                    submitSave(lJSONObject_DataSet);
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest)
                },
            });
        },
        Treedata() {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/clientOperation/getDistrictTree`,
                type: "GET",
                data: {
                    DistrictCode: "232723", //请求参数
                },
                success: (data) => {
                    this.treeData = data;
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
        },
        handleNodeClick(data, node){
            console.log(data.ProvinceNumber);
            this.page.value2 = data.ProvinceNumber;
            if (this.page.activeName == 'first') {
                this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value1 + "%,%" + this.page.value2 + "%")));
            } else {
                this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value1 + "%,%" + this.page.value2 + "%,%"+this.page.activeName+"%")))
            }
            
            this.postgetList(this.page)
        },
        check() {
            if (this.page.activeName == 'first') {
                this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value1 + "%,%" + this.page.value2 + "%")));
            } else {
                this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value1 + "%,%" + this.page.value2 + "%,%"+this.page.activeName+"%")))
            }
            
            this.postgetList(this.page)
        },
    },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus, { locale: zhCn });
app.mount("#app");
